package xkp.Lesson6;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 获取与数据库的连接
 */
public class DBConnection {
    public static Connection getConnection() throws SQLException {
        //1、获取与数据库的连接 需要有 url  user password  [driver]
        String url = "jdbc:mysql://127.0.0.1:3306/" +
                "job_manager?characterEncoding=UTF-8&rewriteBatchedStatements=true";
        String user = "root";
        String password = "123456";
        //com.mysql.jdbc.Connection
        Connection connection = DriverManager.getConnection(url,user,password);
        return connection;
    }
}
